<h2>Problem 171</h2>
<div style="color:#666;font-size:80%;">08 December 2007</div><br />
<div class="problem_content">
<p>For a positive integer <var>n</var>, let f(<var>n</var>) be the sum of the squares of the digits (in base 10) of <var>n</var>, e.g.</p>
<p style="margin-left:50px;">f(3) = 3<img src="" style="display:none;" alt="^(" /><sup>2</sup><img src="" style="display:none;" alt=")" /> = 9,<br />
f(25) = 2<img src="" style="display:none;" alt="^(" /><sup>2</sup><img src="" style="display:none;" alt=")" /> + 5<img src="" style="display:none;" alt="^(" /><sup>2</sup><img src="" style="display:none;" alt=")" /> = 4 + 25 = 29,<br />
f(442) = 4<img src="" style="display:none;" alt="^(" /><sup>2</sup><img src="" style="display:none;" alt=")" /> + 4<img src="" style="display:none;" alt="^(" /><sup>2</sup><img src="" style="display:none;" alt=")" /> + 2<img src="" style="display:none;" alt="^(" /><sup>2</sup><img src="" style="display:none;" alt=")" /> = 16 + 16 + 4 = 36</p>
<p>Find the last nine digits of the sum of all <var>n</var>, 0 <img src='images/symbol_lt.gif' width='10' height='10' alt='&lt;' border='0' style='vertical-align:middle;' /> <var>n</var> <img src='images/symbol_lt.gif' width='10' height='10' alt='&lt;' border='0' style='vertical-align:middle;' /> 10<img src="" style="display:none;" alt="^(" /><sup>20</sup><img src="" style="display:none;" alt=")" />, such that f(<var>n</var>) is a perfect square.</p>
</div><br />
